from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
    def __init__(self):
        super().__init__()
        self.data = None
    def handle_starttag(self, tag, attrs):
        self.data = attrs
    def handle_endtag(self, tag):
        pass

parser = MyHTMLParser()
f = open('currencies.txt', 'r')
lines = f.readlines()
f.close()
f = open('codes.txt', 'w')
for line in lines:
    parser.feed(line)
    parser.close()
    data = parser.data
    for value in data:
        f.write(value[1]+'\n')
f.close()


